home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 37 / CD Expert nº 37.iso / LastCall / lastcall.exe / stuff / lastcall.dxr / 00131_Window utilities.ls < prev    next >
Encoding:
Text File  |  2000-03-27  |  5.8 KB  |  226 lines

  1. global gRecipeWindow, gPourWindow
  2.  
  3. on openPourWindow Initialize
  4.   global gDrinkContentSpr, gLastVessel
  5.   ensurePourWindow()
  6.   if not inMenuMode() and not inBonusMode() then
  7.     restorePourWindowRect()
  8.     open(gPourWindow)
  9.     moveToFront(gPourWindow)
  10.     if gDrinkContentSpr.pLastDirection <> #undocked then
  11.       sendSprite(gDrinkContentSpr, #mShowIfPreviouslyVisible)
  12.     end if
  13.   end if
  14.   if Initialize then
  15.     setPourClockText(" Drink Contents Shown Here", 1)
  16.     gLastVessel = 0
  17.     togglePourClockText(#left, 1)
  18.   end if
  19. end
  20.  
  21. on showRecipeAZ
  22.   openRecipeWindow(0, 0)
  23.   sendRecipeWindowTo("Other")
  24. end
  25.  
  26. on sendRecipeWindowTo newLabel, onlyIfNew
  27.   global gRecipeWindow
  28.   if recipeWindowAtLabel(newLabel) and onlyIfNew then
  29.     exit
  30.   end if
  31.   tell gRecipeWindow
  32.     if integerp(newLabel) or (label(newLabel) > 0) then
  33.       goToLabel(newLabel)
  34.     end if
  35.   end tell
  36. end
  37.  
  38. on refreshRecipes newActiveRecipe
  39.   global gLastCurrent
  40.   if newActiveRecipe then
  41.     sendSprite(barSlotToSprite(newActiveRecipe), #resetRecipe)
  42.     gLastCurrent = newActiveRecipe
  43.     if isWindow(gRecipeWindow) then
  44.       if not isVisible(gRecipeWindow) then
  45.         exit
  46.       end if
  47.       if recipeWindowAtLabel("quickView") then
  48.         sendRecipeWindowTo("quickView", 1)
  49.       else
  50.         if recipeWindowAtLabel("Help") or recipeWindowAtLabel("Help2") then
  51.           nothing()
  52.         else
  53.           if recipeWindowAtLabel("Other") then
  54.             nothing()
  55.           else
  56.             newLabel = "current" & newActiveRecipe
  57.             sendRecipeWindowTo(newLabel)
  58.           end if
  59.         end if
  60.       end if
  61.     end if
  62.   else
  63.     nothing()
  64.   end if
  65. end
  66.  
  67. on openRecipeWindow silent, refresh
  68.   global gRecipeWindowOpenTime, gRecipeWindow, gBarTopManager
  69.   ensureRecipeWindow()
  70.   if refresh then
  71.     refreshRecipes(findActiveRecipeSlot())
  72.   end if
  73.   if not isVisible(gRecipeWindow) then
  74.     gRecipeWindowOpenTime = the ticks - gRecipeWindowOpenTime
  75.   end if
  76.   if not inMenuMode() and not inBonusMode() then
  77.     restoreRecipeWindowRect()
  78.     if not silent then
  79.       soundFX("recipe_sound", 0, 0)
  80.     end if
  81.     open(gRecipeWindow)
  82.     moveToFront(gRecipeWindow)
  83.   end if
  84. end
  85.  
  86. on ensureRecipeWindow
  87.   global gRecipeWindow
  88.   if not isWindow(gRecipeWindow) then
  89.     gRecipeWindow = window("recipe")
  90.     gRecipeWindow.fileName = the pathName & "recipe"
  91.     gRecipeWindow.windowType = 2
  92.     sourceRect = gRecipeWindow.sourceRect
  93.     gRecipeWindow.rect = rect(the stageLeft, the stageTop, the stageLeft + sourceRect.width, the stageTop + sourceRect.height)
  94.   else
  95.     if intersect((the deskTopRectList)[1], gRecipeWindow.rect) = rect(0, 0, 0, 0) then
  96.       sourceRect = gRecipeWindow.sourceRect
  97.       gRecipeWindow.rect = rect(the stageLeft, the stageTop, the stageLeft + sourceRect.width, the stageTop + sourceRect.height)
  98.     end if
  99.   end if
  100. end
  101.  
  102. on ensurePourWindow
  103.   global gPourWindow
  104.   if not isWindow(gPourWindow) then
  105.     gPourWindow = window("pour")
  106.     gPourWindow.fileName = the pathName & "pour"
  107.     gPourWindow.windowType = 2
  108.     sourceRect = gPourWindow.sourceRect
  109.     gPourWindow.rect = rect(the stageRight - sourceRect.width, the stageTop, the stageRight, the stageTop + sourceRect.height)
  110.   else
  111.     if intersect((the deskTopRectList)[1], gPourWindow.rect) = rect(0, 0, 0, 0) then
  112.       sourceRect = gPourWindow.sourceRect
  113.       gPourWindow.rect = rect(the stageRight - sourceRect.width, the stageTop, the stageRight, the stageTop + sourceRect.height)
  114.     end if
  115.   end if
  116. end
  117.  
  118. on forgetAllWindows
  119.   closeAllWindows(0)
  120.   repeat while count(the windowList)
  121.     forget(window(1))
  122.   end repeat
  123.   gRecipeWindow = VOID
  124.   gPourWindow = VOID
  125. end
  126.  
  127. on toggleHelpWindow itemCode
  128.   ensureRecipeWindow()
  129.   if isVisible(gRecipeWindow) and (recipeWindowAtLabel("Help") or recipeWindowAtLabel("Help2")) then
  130.     rememberPourWindowRect()
  131.     closeRecipeWindow()
  132.   else
  133.     openRecipeWindow(0, 0)
  134.     sendRecipeWindowTo("Help2")
  135.   end if
  136.   refreshHelpWindow(itemCode)
  137. end
  138.  
  139. on currentRecipeLabel
  140.   global gLastLabel
  141.   return gLastLabel
  142. end
  143.  
  144. on showGeneralHelp newTitle, newText
  145.   openRecipeWindow(0, 0)
  146.   if isWindow(gRecipeWindow) then
  147.     tell gRecipeWindow
  148.       customHelpItem(newTitle, newText)
  149.     end tell
  150.   end if
  151. end
  152.  
  153. on showSpecificHelp topicCode
  154.   openRecipeWindow(0, 0)
  155.   if isWindow(gRecipeWindow) then
  156.     tell gRecipeWindow
  157.       updateStage()
  158.       customHelpTopic(topicCode)
  159.     end tell
  160.   end if
  161. end
  162.  
  163. on refreshHelpWindow itemCode
  164.   if isWindow(gRecipeWindow) then
  165.     tell gRecipeWindow
  166.       refreshHelpItem(itemCode)
  167.     end tell
  168.   end if
  169. end
  170.  
  171. on togglePourWindow
  172.   global gDrinkContentSpr
  173.   if inBonusMode() then
  174.     beginPause()
  175.     MUIalert("The Pour Meter is not used during the Bonus Shot Round")
  176.     endPause()
  177.     exit
  178.   end if
  179.   ensurePourWindow()
  180.   if isVisible(gPourWindow) then
  181.     if not gDrinkContentSpr.visible then
  182.       setPourClockText(VOID, 1)
  183.       gDrinkContentSpr.visible = 1
  184.     else
  185.       closePourWindow()
  186.     end if
  187.   else
  188.     if gDrinkContentSpr.visible then
  189.       sendSprite(gDrinkContentSpr, #mHideDrinkContents)
  190.     else
  191.       openPourWindow(1)
  192.     end if
  193.   end if
  194. end
  195.  
  196. on toggleRecipeWindow frameName, silent, refresh
  197.   global gRecipeWindowWarnings, gGameLevel, gRecipeWindowOpenTime
  198.   ensureRecipeWindow()
  199.   if isVisible(gRecipeWindow) and not (recipeWindowAtLabel("Help") or recipeWindowAtLabel("Help2")) then
  200.     waitCursor()
  201.     closeRecipeWindow()
  202.     if draggingAnything() then
  203.       hideCursor()
  204.     else
  205.       resetCursor()
  206.     end if
  207.   else
  208.     if gGameLevel > 1 then
  209.       gRecipeWindowWarnings = gRecipeWindowWarnings + 1
  210.       case gRecipeWindowWarnings of
  211.         1:
  212.           managerVO("U11")
  213.         2:
  214.           if not recipeWindowAtLabel("quickView") then
  215.             managerVO("u13")
  216.           end if
  217.         otherwise:
  218.           nothing()
  219.       end case
  220.     end if
  221.     waitCursor()
  222.     openRecipeWindow(silent, refresh)
  223.     sendRecipeWindowTo(frameName, 1)
  224.   end if
  225. end
  226.